package org.gao.service.impl;

import org.gao.domain.Employee;
import org.gao.mapper.EmployeeMapper;
import org.gao.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

@Service
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class EmployeeServiceImpl implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Transactional
    @Override
    public void insert(Employee employee) {
        employeeMapper.insert(employee);
    }
    @Transactional
    @Override
    public void delete(Serializable id) {
        employeeMapper.delete(id);
    }
    @Transactional
    @Override
    public void update(Employee employee) {
        employeeMapper.update(employee);
    }

    @Override
    public List<Employee> selectAll() {
        return employeeMapper.selectAll();
    }

    @Override
    public Employee selectById(Serializable id) {
        return employeeMapper.selectById(id);
    }
}
